test: fix e2e cache-invalidation helper to call invalidate_user - #64
Conversation
_reset_resolution_cache guarded on hasattr(conn, "reset_user"), a method that does not exist on HiveMind connections; the real method is invalidate_user() (hivemind_core.protocol). The hasattr guard was always False, so the resolve_user cache (5s TTL) was never flushed and test_migrated_skill_blacklist_reaches_session silently served a stale pre-migration user, never exercising the migration path it claims to validate. Verified the corrected helper end-to-end: reverting only this source change against the fix makes test_migrated_skill_blacklist_reaches_session fail with "blacklisted_skills missing ['skill-weather']"; restoring it makes the test pass. Full test suite: 68 passed, 3 skipped. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Beep! Your PR results are served. 🍽️I've aggregated the results of the automated checks for this PR below. 📋 Repo HealthI've performed a digital acupuncture on the codebase. 📍 ✅ All required files present. Latest Version: ✅ 🏷️ Release PreviewI've checked the 'Bug Fixes' list for accuracy. 🐛 Current:
✅ PR title follows conventional commit format. 🚀 Release Channel Compatibility Predicted next version:
📊 CoverageEvaluating the thoroughness of our test suite. 🔎 ✅ 85.6% total coverage Per-file coverage (2 files)
Full report: download the 🔍 LintProcessing complete! Details follow. 📬 ❌ ruff: issues found — see job log 🔨 Build TestsThe build bots are giving this a thumbs up. 👍 ✅ All versions pass
🔒 Security (pip-audit)Ensuring our data is safe and secure. 🔐 ✅ No known vulnerabilities found (70 packages scanned). Every line of code matters. Thanks for contributing! 💖 |
The e2e cache-invalidation helper
_reset_resolution_cacheintests/e2e/test_policy_migration_e2e.pycheckedhasattr(conn, "reset_user")before flushing the resolve_user cache on live connections. That method does not exist anywhere in the codebase; the real method isinvalidate_user(), defined on the HiveMind connection inhivemind_core/protocol.py. Because the guard always evaluated to False, the 5-second resolve_user cache was never flushed, sotest_migrated_skill_blacklist_reaches_sessionserved a stale pre-migration user and never actually exercised the migration path it claims to validate.This changes the guard to check for and call
invalidate_user()instead. Only the test file is touched; no product code changed.I verified this end-to-end rather than trusting the diff. With the fix reverted (patch-revert, not stash) the test fails with
blacklisted_skills missing ['skill-weather']. With the fix restored it passes, confirming the migrated blacklist now reaches the OVOS session as intended. The full test suite (68 tests, 3 skipped) passes with the fix in place.